// 将字符串对象化
export const scene2Object = (str) => {
  const params = {};
  if (!str) return params;
  const strs = str.split('&');
  for (let i = 0; i < strs.length; i++) {
    params[strs[i].split('=')[0]] = unescape(strs[i].split('=')[1]);
  }
  return params;
}

// 格式化小程序参数
export const getOptions = (options) => {
  let params = {};
  if (options.scene) {
    // sccene
    params = scene2Object(decodeURIComponent(options.scene));
  } else {
    // 普通
    params = options;
  }
  return params;
}